<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import= "com.roadmap.common.BaseConst"%>
<%@ page import="com.roadmap.struts.action.ActionConst"%>
<%@ page import="com.roadmap.common.RdcResourceBundle" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String user_ssn_id = (String)request.getAttribute(ActionConst.Aspirant_Id_In_Session);
String user_req_id = request.getParameter(ActionConst.Aspirant_Id_In_Request);
if(user_req_id == null){
	user_req_id = user_ssn_id;
}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/> 
<link href="res/css/layout.css" rel="stylesheet" type="text/css" media="all" />
<link href="res/css/sns.css" rel="stylesheet" type="text/css" media="all" />
<link href="res/css/widget.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="dwr/util.js"></script>
<script type="text/javascript" src="dwr/engine.js"></script>
<script type="text/javascript" src="dwr/interface/RdcAjax.js"></script>
<script type="text/javascript" src="res/js/func.js"></script>
<script type="text/javascript" src="res/js/component.js"></script>
<script type="text/javascript" src="res/js/widget.js"></script>
<title><bean:write name="<%=ActionConst.Aspirant_Name_In_Request %>"/>的好友 | <%=RdcResourceBundle.COMPANY_NAME %></title>

</head>

<body>
	<jsp:include page="/admin/myheader.jsp"></jsp:include>
	
	<div class="mainbody"><div class="manager">
	<jsp:include page="/admin/sns/nav_btns.jsp"/>
	
	<!-- middle part: content -->
	<div class="middle-part">
		<div class="section">
			<div class="title-sp"><a href="aspirant.do?uid=<%=user_req_id %>"><bean:write name="<%=ActionConst.Aspirant_Name_In_Request %>"/></a>的好友</div><br/><br/>
			<div class="friendlist">
				<logic:notPresent name="friends"><span class="prompt-message">该分组没有好友</span></logic:notPresent>
				
				<logic:present name="friends">
				<ul>
					<logic:iterate id="friend" name="friends">
					<bean:define id="fid" name="friend" property="friendId"/>
					<li id="friend<%=fid %>">
						<div class="smallpicture"><a href="aspirant.do?uid=<%=fid %>"><img src="<%=BaseConst.PURIKURA_DIR_SMALL%><%=fid %>.gif" alt="<%=RdcResourceBundle.COMPANY_NAME %>"/></a></div>
						<div class="friend">
							<ul>
								<li><a href="aspirant.do?uid=<%=fid %>"><span id="fname<%=fid %>"><bean:write name="friend" property="name"/></span></a></li>
								<li>频率：<bean:write name="friend" property="frequency"/><input id="gid<%=fid %>" type="hidden" value="<bean:write name='friend' property='groupId'/>"/></li>
								<li><a href="javascript:chooseGroup('<%=fid %>');" title='更改分组'><img src="res/images/logo/group_16.png"/></a>&nbsp;&nbsp;&nbsp;
									<a href="javascript:removeFriend('<%=fid %>');" title="取消好友关系"><img src="res/images/logo/disconnect_16.png"/></a>
								</li>
							</ul>
						</div>
					</li>
					</logic:iterate>
				</ul>
				</logic:present>
			</div>
			
		</div>
	</div>
		
	<div class="right-part"></div>
	</div>
	
	<div class="clear-div"></div>
	</div>
	
	<jsp:include page="/res/jsp/footer.jsp"></jsp:include>

<script type="text/javascript">

	// if(typeof groups == "undefined") groups = null;
	var selectGroupDlg = new SelectGroupPopup();
	var addGroupDlg = new AddGroupPopup();
	var removeGroupDlg = new RemoveGroupPopup();
	var editGroupDlg = new EditGroupPopup();
	var removeFriendDlg = new RemoveFriendPopup();
	
	function chooseGroup(fid){
		friend = {fid:fid};
		friend.name = $("fname" + fid).innerHTML;
		friend.gid = $("gid" + fid).innerHTML;
		selectGroupDlg.setData(friend);
		selectGroupDlg.show();
	}
	
	function addGroup(){
		addGroupDlg.setData($("groupList"), $("groupTemp"));
		addGroupDlg.show();
	}
	
	function editGroup(){
		editGroupDlg.show();
	}
	
	function removeGroup(){
		removeGroupDlg.show();
	}
	
	function removeFriend(fid){
		friend = {friendId:fid};
		friend.name = $("fname" + fid).innerHTML;
		friend.groupId = $("gid" + fid).innerHTML;
		removeFriendDlg.setData(friend, $("friend" + fid));
		removeFriendDlg.show();
	}
	
	
</script>

</body>

</html>
